How to upgrade Node.JS to the latest version

How to upgrade nodejs to latest version

In this article, we’ll cover all methods of how to upgrade NodeJs to Latest version in Linux Os, Ubuntu Os, Windows 7, 8, 10, and Mac Osx using NPM (Node Package Manager) and NVM (Node Version Manager). And finally, we ‘re going to explore the Best way to upgrade Node. JS

Node.js helps in the development of fast and extensible applications as a runtime environment. And not only are the apps fast-so are the updates. They come on once every few weeks, improving protection, stability and adding some new features.

And if you want an update, in fact, there is a very easy way to do that. Here are some of the ways to update Node on different operating systems.

Also Read: File Upload in Node js using Multer

How to upgrade nodejs to latest version using pre-installed Node Package Manager (npm)

You can also update your node.js using the Node Package Manager (npm). Node comes with a package manager that has already been pre-installed-but before you update Node.js, you need to make sure that npm is the latest version as well.

  • First, you may want to find out the Node Package Manager version you have, by running an npm -v command.
  • Once done, use npm install npm@latest -g command to install the latest Node Package Manager version available.
  • Finally, use npm -v command to confirm whether your new Node Package Manager was successfully installed.

To update node.js using the Node Package Manager, use the Node Package Manager’s n module

1. First, clear the npm cache:

For Window:
npm cache clean -f

For Linux, Ubuntu or MAC
sudo npm cache clean -f

2. Install n, Node’s version manager:

For Window:
npm install -g n

For Linux, Ubuntu or MAC
sudo npm install -g n

3. Install the latest stable version: 

For Window:
n stable

For Linux, Ubuntu or MAC
sudo n stable

How to upgrade nodejs to latest version using Node Version Manager (nvm):

Node Version Manager (NVM) is a popular way to upgrade your node.js.

1. update the package repository

sudo apt update

2. Download the required dependencies

sudo apt install build-essential checkinstall libssl-dev

3. Install NVM using the curl command:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.1/install.sh | bash

You can use Wget as well. Here’s the script:

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

4. Close and reopen the terminal.

5. Now, verify if you have successfully installed NVM:

nvm --version

6. Before upgrading Node.js, check which version you have running on the system:

nvm ls

7. Now you can check for newly available releases with:

nvm ls-remote

8. Download and install a new version of node.js.

nvm install #.#.# 

OR

nvm install version.number

Wrapping Words!

Well, I hope you found Complete Steps How to upgrade nodejs to latest version tutorial helpful for your project. Keep learning!. If you face any problem – I am here to solve your problems.

Are you want to get implementation help, or modify or extend the functionality of this script? Submit a paid service request

Related posts